package ProxyPattern;

public class ProxyUser {
    private User proxyuser;

    public ProxyUser(User proxyuser) {
        this.proxyuser = proxyuser;
    }
    public void proxymenu() {
        this.proxyuser.menu();
    }
    public void addBook(String bookname) {
        System.out.println(this.proxyuser.name+"开始检查权限：");
        if(proxyuser instanceof AdminUser) {
            ((AdminUser) proxyuser).addBook(bookname);
        }else System.out.println(this.proxyuser.name+"，您没有权限上架书籍");
    }
}
